﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using TyMES.Model;
using TyMES.Model.BaseInformation;

namespace TyMES.Model.BaseInformation
{
    /// <summary>
    /// 产线管理
    /// </summary>
	[Table("T_Lines")]
    [SoftKey(nameof(Line.LineCode))]
    [Display(Name = "_Model.Line")]
    public class Line : BasePoco,IPersistPoco
    {
        [Display(Name = "_Model._Line._LineCode")]
        [StringLength(100, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("产线编码")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [CanNotEdit]
        public string LineCode { get; set; }
        [Display(Name = "_Model._Line._LineName")]
        [StringLength(100, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("产线名称")]
        public string LineName { get; set; }
        [Display(Name = "_Model._Line._WorkshopCode")]
        [Comment("车间编码")]
        [NotMapped]
        public Workshop WorkshopCode { get; set; }
        [Display(Name = "_Model._Line._WorkshopCode")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [Comment("车间编码")]
        public string WorkshopCodeId { get; set; }
        [Display(Name = "_Model._Line._ResponsibleId")]
        [StringLength(100, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("负责人")]
        public string ResponsibleId { get; set; }
        [Display(Name = "_Model._Line._Base_Status")]
        [Comment("产线状态")]
        public BaseStatusEnum? Base_Status { get; set; }
        [Display(Name = "_Model._Machine._LineCode")]
        [InverseProperty("LineCode")]
        [NotMapped]
        [SoftFK(nameof(TyMES.Model.BaseInformation.Machine.LineCodeId))]
        public List<Machine> Machine_LineCode { get; set; }
        [Display(Name = "_Model._Operation._LineCode")]
        [InverseProperty("LineCode")]
        [NotMapped]
        [SoftFK(nameof(TyMES.Model.BaseInformation.Operation.LineCodeId))]
        public List<Operation> Operation_LineCode { get; set; }
        [Display(Name = "_Model._Person._LineCode")]
        [InverseProperty("LineCode")]
        [NotMapped]
        [SoftFK(nameof(TyMES.Model.BaseInformation.Person.LineCodeId))]
        public List<Person> Person_LineCode { get; set; }
        [Display(Name = "_Model._Station._LineCode")]
        [InverseProperty("LineCode")]
        [NotMapped]
        [SoftFK(nameof(TyMES.Model.BaseInformation.Station.LineCodeId))]
        public List<Station> Station_LineCode { get; set; }
        [Display(Name = "_Model._Line._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;

	}

}
